import request from '@/utils/request1'

// const token =
//   'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjoxIiwicm5TdHIiOiIxZW9vVjNDQU9jOHJmallOTzkwY2FscFpjQXp6amEwaiIsInVzZXJJZCI6MX0.Isb6yTN4-Xrf3zoZ90B9FfianWp_GdAcfNC1y8BLs4U'
// export function getToken() {
//   return token
// }
// 查询用户列表
export function listUser(query) {
  return request({
    url: '/system/user/list',
    method: 'get',

    params: query
  })
}
// 查询用户详细
export function getUser(userId) {
  return request({
    url: `/system/user/${userId}`,
    method: 'get'

    // skipInterceptor: true,
    // headers: {
    //   Authorization: token
    // }
  })
}
// 新增用户
export function addUser(data) {
  return request({
    url: '/system/user',
    method: 'post',
    data: data
  })
}
// 修改用户
export function updateUser(data) {
  return request({
    url: '/system/user',
    method: 'put',
    data: data
  })
}
// 删除用户
export function delUser(userId) {
  return request({
    url: '/system/user/' + userId,
    method: 'delete'
  })
}
// 根据系统获取相应角色
export function roleBySystem(query) {
  return request({
    url: '/system/user/getRoleBySystem',
    method: 'get',
    params: query
  })
}
// 查询角色选择框列表
export function roleOptionList() {
  return request({
    url: '/system/role/optionselect',
    method: 'get'
  })
}
// 查询部门下拉树结构
export function deptTreeSelect() {
  return request({
    url: '/system/user/deptTree',
    method: 'get'
  })
}

export function deptOtherId() {
  return request({
    url: '/system/user/getDeptOtherId',
    method: 'get'
  })
}

// role.js
// 查询角色列表
export function listRole(query) {
  return request({
    url: '/system/role/list',
    method: 'get',
    params: query
  })
}
// 新增角色
export function addRole(data) {
  return request({
    url: '/system/role',
    method: 'post',
    data: data
  })
}
// 查询菜单下拉树结构
export function treeselect(query) {
  return request({
    url: '/system/menu/treeselect',
    method: 'get',
    params: query
  })
}
// 查询角色详细
export function getRole(roleId) {
  return request({
    url: '/system/role/' + roleId,
    method: 'get'
  })
}
// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
  return request({
    url: '/system/menu/roleMenuTreeselect/' + roleId,
    method: 'get'
  })
}
// 修改角色
export function updateRole(data) {
  return request({
    url: '/system/role',
    method: 'put',
    data: data
  })
}
// 删除角色
export function delRole(roleId) {
  return request({
    url: '/system/role/' + roleId,
    method: 'delete'
  })
}

// menu.js
// 查询菜单列表
export function listMenu(query) {
  return request({
    url: '/system/menu/list',
    method: 'get',
    params: query
  })
}
// 查询菜单详细
export function getMenu(menuId) {
  return request({
    url: '/system/menu/' + menuId,
    method: 'get'
  })
}

// 新增菜单
export function addMenu(data) {
  return request({
    url: '/system/menu',
    method: 'post',
    data: data
  })
}
// 修改菜单
export function updateMenu(data) {
  return request({
    url: '/system/menu',
    method: 'put',
    data: data
  })
}
// 删除菜单
export function delMenu(menuId) {
  return request({
    url: '/system/menu/' + menuId,
    method: 'delete'
  })
}

export function getNowInfo() {
  return request({
    url: '/getNowInfo',
    method: 'get'
  })
}
